#include "cmdline/cmdline.h"
#include <directory_scanner/directory_scanner.h>

#include <stdio.h>

int
main(int argc, char *argv[])
{
  tgnews_options_t options = parse_cmdline(argc, argv);
  gimme_file_func func = scan_directory(options.directory);
  INITIALIZE_HTML_FILE_HANDLER(file_handler);
  func(file_handler);
  puts(get_filename(file_handler));
  FILE *stream = obtain_file_stream(file_handler);
  char buffer[512];
  size_t ret_code = fread(buffer, sizeof *buffer, 512, stream);
  if (ret_code == 512)
    {
      puts("Array read successfully, contents: ");
      for(int n = 0; n < 512; ++n) printf("%c", buffer[n]);
      putchar('\n');
    }
  REMOVE_FILE_HANDLER(file_handler);
}
